<Query Kind="Program">
  <Connection>
    <ID>f2f6e2b4-0f40-48df-b2c7-82584a77c393</ID>
    <AttachFileName>&lt;ApplicationData&gt;\LINQPad\Nutshell.mdf</AttachFileName>
    <Server>.\SQLEXPRESS</Server>
    <AttachFile>true</AttachFile>
    <UserInstance>true</UserInstance>
  </Connection>
  <Reference>&lt;ProgramFiles&gt;\Microsoft Visual Studio 9.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll</Reference>
</Query>

//public static List<metacdr> listmetacdr=new List<metacdr>();
//	public static Composite root0 = new Composite();
//	public static Composite comp = new Composite();
	public static cdr cdrlist=new cdr();
	static void Main()
	{
//	 listmetacdr=new List<metacdr>();
		string path = "";
		string file=@"F:\LenovoHP\ICDR_EDGE\Temp\test.xml";
//		metacdr m = new metacdr(path,file);
//		root0 = new Composite(m);
		XmlDocument doc = new XmlDocument();
		doc.Load(file);
		XmlElement root = doc.DocumentElement;
		Get(root, path);
//		root0.Diaplay (0);
//			root0.listmetacdr ;
//		root0.listmetacdr .Dump ();
//listmetacdr.SingleOrDefault(n=>n.path.Length >10);
//    	var q =            
//    	from p in listmetacdr
//    	group p by p.path  into g
//    	select new {g.Key ,a=g.Count ()};
//    	q.Dump ();
//		listmetacdr.ToDictionary
	}

	public static void Get(XmlNode node, string path)
	{
		if (!node.HasChildNodes)
		{
//			metacdr m = new metacdr(path, node.InnerText);
			if (node.InnerText.IndexOf("message") != -1)
			{
//				comp = new Composite(m);
//				root0.Add(comp);
			}
			else
//				comp.Add(new Leaf(m));
		}
		else
		{
			path += node.Name + "/";
			foreach (XmlNode n in node.ChildNodes)
			{
				Get(n, path);
			}
		}
	}
//------------------------------------------------------------------------------
// <auto-generated>
//     此代码由工具生成。
//     运行时版本:2.0.50727.3053
//
//     对此文件的更改可能会导致不正确的行为，并且如果
//     重新生成代码，这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------

//using System.Xml.Serialization;

// 
// This source code was auto-generated by xsd, Version=2.0.50727.3038.
// 


/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
[System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)]
public partial class cdr {
	
	private cdrMessage[] itemsField;
	
	/// <remarks/>
	[System.Xml.Serialization.XmlElementAttribute("message", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
	public cdrMessage[] Items {
		get {
			return this.itemsField;
		}
		set {
			this.itemsField = value;
		}
	}
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
public partial class cdrMessage {
	
	private string numberField;
	
	private cdrMessageContext[] contextField;
	
	/// <remarks/>
	[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
	public string number {
		get {
			return this.numberField;
		}
		set {
			this.numberField = value;
		}
	}
	
	/// <remarks/>
	[System.Xml.Serialization.XmlElementAttribute("context", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
	public cdrMessageContext[] context {
		get {
			return this.contextField;
		}
		set {
			this.contextField = value;
		}
	}
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
public partial class cdrMessageContext {
	
	private string nameField;
	
	private string metavalueField;
	
	/// <remarks/>
	[System.Xml.Serialization.XmlAttributeAttribute()]
	public string name {
		get {
			return this.nameField;
		}
		set {
			this.nameField = value;
		}
	}
	
	/// <remarks/>
	[System.Xml.Serialization.XmlAttributeAttribute()]
	public string metavalue {
		get {
			return this.metavalueField;
		}
		set {
			this.metavalueField = value;
		}
	}
}

